import Vue from 'vue'
import VueRouter from 'vue-router'
import MovieView from '@/views/MovieView.vue'
import CinemaView from '@/views/CinemaView'
import MineView from '@/views/MineView.vue'



Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'mine',
  },
  {
    path: '/movie',
    name: 'movie',
    component: MovieView,
    children:[{
      // 记得孩子的path不用加/
      path:'city',
      component:()=>import("../components/City.vue")
    },{
      path:'now',
      component:()=>import("@/components/Now.vue")
    },{
      path:'coming',
      component:()=>import("@/components/Coming.vue")
    },{
      path:'search',
      component:()=>import("@/components/Search.vue")
    }]
  },
  {
    path: '/cinema',
    name: 'cinema',
    component: CinemaView
  },
  {
    path: '/mine',
    name: 'mine',
    component: MineView
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
